package domain.jsoft.com;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;

@PersistenceCapable
public class GaeUser implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -2018835600848545133L;

	@Persistent
	private String userId;
	@Persistent
	private String email;
	@Persistent
	private String nickname;
	@Persistent
	private String firstname;
	@Persistent
	private String lastname;
	@Persistent
	private long authorities;
	
	private Set<AppRole> roles;
	
	@Persistent
	private boolean enabled;
	
	public GaeUser(String userId, String nickname, String email){
		this.userId = userId;
		this.nickname = nickname;
		this.email = email;
		this.enabled = true;
		this.roles = new HashSet<AppRole>();
		this.roles.add(AppRole.NEW_USER);
	}
	
	public GaeUser(String userId, String nickname, String email, String firstname, String lastname, Set<AppRole> roles, Boolean enabled){
		this.nickname = nickname;
		this.userId = userId;
		this.firstname = firstname;
		this.lastname = lastname;
		this.email = email;
		this.roles = roles;
		this.enabled = enabled;
	}
	
	public long getAuthorities(){
		return this.authorities;
	}
	
	public void setAuthorities(long authorities){
		this.authorities = authorities;
	}
	
	public void setUserId(String userId){
		this.userId = userId;
	}
	  
	public String getUserId(){
		return this.userId;
	}
	
	public void setEmail(String email){
		this.email = email;
	}
	  
	public String getEmail(){
		return this.email;
	}
	
	public void setNickname(String nickname){
		this.nickname = nickname;
	}
	  
	public String getNickname(){
		return this.nickname;
	}
	
	public void setFirstname(String firstname){
		this.firstname = firstname;
	}
	  
	public String getFirstname(){
		return this.firstname;
	}
	
	public void setLastname(String lastname){
		this.lastname = lastname;
	}
	  
	public String getLastname(){
		return this.lastname;
	}
	
	public void setRoles(Set<AppRole> roles){
		this.roles = roles;
	}
	  
	public Set<AppRole> getRoles(){
		return this.roles;
	}
	
	public void setEnabled(boolean enabled){
		this.enabled = enabled;
	}
	  
	public boolean isEnabled(){
		return this.enabled;
	}
	
}